package com.hopu.petshop.controller.old;//package com.hopu.petshop.controller;
//
//import com.hopu.petshop.service.PetService;
//
//import javax.servlet.ServletException;
//import javax.servlet.annotation.WebServlet;
//import javax.servlet.http.HttpServlet;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.sql.SQLException;
//
///**
// * 分页查找宠物的Servlet
// */
//@WebServlet("/findPetsPage.do")
//public class FindPetsPageServlet extends HttpServlet {
//
//    //用spring创建service对象
//    private PetService petService = SpringConfig.getContext().getBean(PetService.class);
//
//    @Override
//    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        //接收当前页数
//        String current = req.getParameter("current");
//        int curr = 1;
//        if(current != null){
//            curr = Integer.valueOf(current);
//        }
//        //调用PetService对象
//        try {
//            //执行查询，把集合存到request中
//            req.setAttribute("page", petService.findPetsPage(curr));
//            //跳转到宠物列表页面
//            req.getRequestDispatcher("pets.jsp").forward(req,resp);
//        } catch (SQLException e) {
//            e.printStackTrace();
//        }
//    }
//
//    @Override
//    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        doGet(req,resp);
//    }
//}
